/**
 * authService - factory
 * 封装一个http登录验证服务
 */
class authService {
    constructor($cookieStore, UserService) {

        this.$cookieStore = $cookieStore;
        this.UserService  = UserService;

        this.isAuthorized = () => {
            return  this.UserService.postCheckLogin(this.$cookieStore.get('access_token'))
                    .then((data) => {
                        // console.log(data)
                        return data.data.is_login;
                    }, (data) => {
                        console.log('error')
                    });
        }
    }

    isAuthorized() {
        return this.isAuthorized()
    }
}

authService.$inject = ['$cookieStore', 'UserService'];

export default authService;